package com.hyl.auth.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hyl.auth.entity.User;
import com.hyl.auth.service.UserService;
import com.hyl.auth.utils.Result;
import com.hyl.auth.vo.UserQueryVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lemon
 * @since 2023-06-19
 */
@RestController
@RequestMapping("/api/user")
public class UserController {


	@Resource
	private UserService userService;
	/**
	 * 查询用户列表
	 * @param userQueryVo
	 * @return
	 */
	@GetMapping("/list")
	public Result list(UserQueryVo userQueryVo) {
		//创建分页信息
		IPage<User> page = new Page<User>(userQueryVo.getPageNo(),
				userQueryVo.getPageSize());
		//调用分页查询方法
		userService.findUserListByPage(page, userQueryVo);
		//返回数据
		return Result.ok(page);
	}

}

